package tp.pr4.gui;


import javax.swing.*;
import javax.swing.border.TitledBorder;

import javax.swing.JComponent;
import java.awt.Container;
import java.awt.Component;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import java.util.EnumMap;

import tp.pr4.Direction;
	
/**
 * This class is in charge of the panel that displays the information about the robot 
 * heading and the city that is traversing. It contains the grid that represents the 
 * city in the Swing interface, a text area to show the place descriptions, and a label 
 * with an icon which represents the robot heading 
 *
 * The 11x11 grid contains PlaceCell objects and the first place starts at (5,5). This 
 * panel will update the visited places when the robot moves from one place to another. 
 * Additionally it will show the place description on a text area if the user clicks on 
 * a visited place. 
 * @author Alvaro Saez Hernando
 * @author Noel Clemente Montero 
 */
public class NavigationPanel extends javax.swing.JPanel {


	private static final long serialVersionUID = 1L;

	/**
	 * Default constructor
	 */
	public NavigationPanel(){
		super();

		this.setLayout(new BorderLayout());
		JPanel pRobotImage = new JPanel();
			
		ImageIcon robotImage = new ImageIcon("headingIcons/walleNorth.png");
		//ImageIcon robotImage = getImage();
		JLabel lbRobotIcon = new JLabel(robotImage); 
		Box boxImage = Box.createVerticalBox();
		boxImage.add(Box.createVerticalGlue());
		boxImage.add(pRobotImage.add(lbRobotIcon));
		boxImage.add(Box.createVerticalGlue());
		
		
		JPanel pCity= new JPanel();
		pCity.setBorder(new TitledBorder("City Map"));
		pCity.setLayout(new GridLayout(11,11));
		
		for (int i = 0; i < 11; i++) {
			for (int j = 0; j < 11; j++) {
				pCity.add(new PlaceCell());
			}
		}
		
		JPanel pLog = new JPanel();
		pLog.setBorder(new TitledBorder("Log"));
		pLog.setLayout(new BorderLayout());
		JTextArea txtLog = new JTextArea(8,100);
		txtLog.setEditable(false);
		pLog.add(new JScrollPane(txtLog),BorderLayout.CENTER);
		
		this.add(pCity, BorderLayout.CENTER);
		this.add(boxImage, BorderLayout.WEST);
		this.add(pLog, BorderLayout.SOUTH);
		
	}
	
	private ImageIcon getImage(){
		
		
		return null;	
	}
	
}
